home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / ams__l~1.zoo / include / doublebu.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-05  |  1.1 KB  |  47 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  This file is part of the Atari Machine Specific Library,
  4. //  and is Copyright 1992 by Warwick W. Allison.
  5. //
  6. //  You are free to copy and modify these sources, provided you acknowledge
  7. //  the origin by retaining this notice, and adhere to the conditions
  8. //  described in the file COPYING.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11.  
  12. #ifndef _DoubleBuffer_h
  13. #define _DoubleBuffer_h
  14. //
  15. //  Encapsulated Double Buffering support.
  16. //
  17.  
  18. #include "Screen.h"
  19.  
  20. class DoubleBuffer
  21. {
  22. public:
  23.     DoubleBuffer();
  24.     DoubleBuffer(Screen&,Screen&);
  25.  
  26.     void    Flip();    // Swap pages smoothly (synced to retrace)
  27.     void    Flop();    // Swap pages immediately (unsynced)
  28.     char     *Location();
  29.  
  30.     Screen& NowShowing();
  31.     Screen&    Current();
  32.  
  33.     short Pulse;
  34.  
  35. private:
  36.     Screen* Canvas[2];
  37. };
  38.  
  39. extern    DoubleBuffer *Pages;
  40.  
  41.  
  42. inline char *DoubleBuffer::Location() { return Canvas[Pulse]->Location(); }
  43. inline Screen& DoubleBuffer::NowShowing() { return *Canvas[1-Pulse]; }
  44. inline Screen&    DoubleBuffer::Current() { return *Canvas[Pulse]; }
  45.  
  46. #endif
  47.